import Vue from 'vue'
import App from './App.vue'
import axios from 'axios'
import VueAxios from 'vue-axios'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import router from './router'
import store from './store'
import Cookies from "js-cookie";
import {ACCESS_TOKEN} from "./store/mutations-type";

Vue.use(ElementUI);
Vue.use(VueAxios, axios);

Vue.config.productionTip = false;

new Vue({
    router,
    //store:store 和router一样，将我们创建的Vuex实例挂载到这个vue实例中
    store,
    mounted() {
        // 项目重启仍能保证vuex中存在token
        store.commit('SET_TOKEN', Cookies.get(ACCESS_TOKEN));
    },
    render: h => h(App),
}).$mount('#app');
